Add $wgUserLanguages array to specify which languages users are allowed
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 8 Sep 2004 07:35:00 +0000 (07:35 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 8 Sep 2004 07:35:00 +0000 (07:35 +0000)
to select for the user interface. If this is left at the default empty
array the selection is disabled.

Currently the language selection is broken and will fail for many
cases, using bogus namespaces and probably corrupting your database
with bogus links, search index updates, and more.

includes/DefaultSettings.php
includes/Setup.php

index 93b9728..133ab55 100644 (file)
@@ -248,6 +248,15 @@ $wgUseTurckShm      = false;
  */
 $wgLanguageCode     = 'en';
 
+/**
+ * Languages which the user may select to display the user interface
+ * in instead of the default language. This option is currently
+ * experimental and WILL FAIL FOR MANY COMMON TASKS AND PERHAPS
+ * CORRUPT YOUR DATABASE WITH BOGUS DATA.
+ * Set to eg array( 'en', 'fr', 'zh' ) etc
+ */
+$wgUserLanguages = array();
+
 /**
  * Filename of a language file generated by dumpMessages.php
  * @global string|false $wgLanguageFile (default:false)
index c48aa8e..ba9daef 100644 (file)
@@ -217,12 +217,17 @@ if( $wgCommandLineMode ) {
 }
 
 // FIXME : we don't know what the user entered (see SpecialPreferences.php [AV])
-if(isset($wgUser->mOptions['language'])) {
+if( count( $wgUserLanguages ) &&
+       !empty( $wgUser->mOptions['language'] ) &&
+       in_array( $wgUser->mOptions['language'], $wgUserLanguages ) ) {
        // Change language of the site
        $wgLanguageCode = $wgUser->mOptions['language'];
        // we will load messages from file instead of from database
        $wgUseDatabaseMessages = false;
-       }
+       # FIXME: THIS WILL BREAK NAMESPACES, VARIABLES,
+       # SEARCH INDEX UPDATES, AND MANY MANY THINGS.
+       # DO NOT USE THIS MODE EXCEPT FOR TESTING RIGHT NOW.
+}
 
 wfProfileOut( $fname.'-User' );
 wfProfileIn( $fname.'-language' );